package com.iplant.mes.service.po.sfc;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.pdm.service.basicenum.pdm.PDMComponentTypes;

/**
 * 组装记录（元件→芯子、芯子→芯组、芯组→成品、成品→装箱）
 *
 * @author YouWang·Peng
 * 2023-12-1 11:06:35
 */
@DBBasePO(TableName = "sfc_assembly_record", Name = false, Active = false, Schemas = DBSchemas.MES,
        CheckName = {"Code", "SourceCode,TargetCode"}, CodeAuto = true, CodePrefix = "SAR-{yyyyMMdd}-", CodeNum = 4)
public class SFCAssemblyRecord extends BasePO {
    /**
     * 来源类型
     */
    @DBCondition
    @DBField
    public int ComponentType = 0;
    /**
     * 来源类型
     */
    public String ComponentTypeName = "";
    /**
     * 产出类型
     */
    @DBCondition
    @DBField
    public int TargetComponentType = 0;
    /**
     * 产出类型
     */
    public String TargetComponentTypeName = "";
    /**
     * 来源工件码
     */
    @DBCondition
    @DBField
    public String SourceCode = "";
    /**
     * 产出工件码
     */
    @DBCondition
    @DBField
    public String TargetCode = "";

    public SFCAssemblyRecord() {
    }

    public SFCAssemblyRecord(int componentType, int targetComponentType, String sourceCode, String targetCode) {
        ComponentType = componentType;
        TargetComponentType = targetComponentType;
        SourceCode = sourceCode;
        TargetCode = targetCode;
    }

    @JsonProperty("ComponentType")
    public int getComponentType() {
        return ComponentType;
    }

    public void setComponentType(int componentType) {
        ComponentType = componentType;
    }

    @JsonProperty("ComponentTypeName")
    public String getComponentTypeName() {
        ComponentTypeName = PDMComponentTypes.getEnumType(ComponentType).getLabel();
        return ComponentTypeName;
    }

    public void setComponentTypeName(String componentTypeName) {
        ComponentTypeName = componentTypeName;
    }

    @JsonProperty("TargetComponentType")
    public int getTargetComponentType() {
        return TargetComponentType;
    }

    public void setTargetComponentType(int targetComponentType) {
        TargetComponentType = targetComponentType;
    }

    @JsonProperty("TargetComponentTypeName")
    public String getTargetComponentTypeName() {
        TargetComponentTypeName = PDMComponentTypes.getEnumType(TargetComponentType).getLabel();
        return TargetComponentTypeName;
    }

    public void setTargetComponentTypeName(String targetComponentTypeName) {
        TargetComponentTypeName = targetComponentTypeName;
    }

    @JsonProperty("SourceCode")
    public String getSourceCode() {
        return SourceCode;
    }

    public void setSourceCode(String sourceCode) {
        SourceCode = sourceCode;
    }

    @JsonProperty("TargetCode")
    public String getTargetCode() {
        return TargetCode;
    }

    public void setTargetCode(String targetCode) {
        TargetCode = targetCode;
    }
}
